package com.demo.chat.server;

import java.nio.channels.SocketChannel;

public class Request {

	private SocketChannel socketChannel;
	private byte[] dataInput = null;;
	Object obj;

	public Request(SocketChannel sc) {
		this.socketChannel = sc;
	}

	public SocketChannel getSocketChannel() {
		return socketChannel;
	}
	public java.net.InetAddress getAddress() {
		return socketChannel.socket().getInetAddress();
	}

	public int getPort() {
		return socketChannel.socket().getPort();
	}

	public boolean isConnected() {
		return socketChannel.isConnected();
	}

	public boolean isBlocking() {
		return socketChannel.isBlocking();
	}

	public boolean isConnectionPending() {
		return socketChannel.isConnectionPending();
	}

	public boolean getKeepAlive() throws java.net.SocketException {
		return socketChannel.socket().getKeepAlive();
	}

	public int getSoTimeout() throws java.net.SocketException {
		return socketChannel.socket().getSoTimeout();
	}

	public boolean getTcpNoDelay() throws java.net.SocketException {
		return socketChannel.socket().getTcpNoDelay();
	}

	public boolean isClosed() {
		return socketChannel.socket().isClosed();
	}

	public void attach(Object obj) {
		this.obj = obj;
	}

	public Object attachment() {
		return obj;
	}

	public byte[] getDataInput() {
		return dataInput;
	}

	public void setDataInput(byte[] dataInput) {
		this.dataInput = dataInput;
	}

}
